package com.xyz.service;

import com.xyz.dao.logic.SSettingLogic;
import com.xyz.domain.constants.EhCacheConstants;
import com.xyz.domain.table.SSetting;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SSettingService extends BaseService {

    @Autowired
    SSettingLogic settingLogic;

    @Cacheable(value = EhCacheConstants.SysSettingCache, key = "#type")
    public List<SSetting> getSettings(String type){
        SSetting setting = new SSetting();
        setting.setType(type);
        return settingLogic.list(setting, StringUtils.EMPTY);
    }

    @CacheEvict(value = EhCacheConstants.SysSettingCache,allEntries=true)
    public void refresh(){

    }
}
